package com.example.gramediamajalahmobile.search;


import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

import com.example.gramediamajalahmobile.R;

public class Search extends Activity {
	 


	EditText txtSearchTitle;	
	 
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.search);
       
        txtSearchTitle = (EditText) findViewById(R.id.searchtext);
        
        Button search = (Button) findViewById(R.id.buttonsearch);
       search.setOnClickListener(new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			switch (v.getId()) {
	        case R.id.buttonsearch:
	        	ProgressDialog dialog = ProgressDialog.show(Search.this, "", "please wait....");
		 		 	  String keywords = txtSearchTitle.getText().toString();
		 		 	keywords= Uri.encode(keywords);
		 		   
		 		   System.out.println("Search string => "+keywords);
		      Log.i("KEY", keywords);
		      Intent in = new Intent(Search.this, ResultSearch.class);
		      in.putExtra("keyword", keywords);
		      startActivity(in);
			 }
		}
	});
    }



		
	}